package com.lipaluma.xml.validator;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

import com.lipaluma.field.validator.ValidatorFactory;

@XmlRootElement(name=XmlMinValidator.MIN)
@XmlAccessorType(XmlAccessType.FIELD)
public class XmlMinValidator implements XmlValidator, XmlMinMaxValidator {
	public static final String MIN = "min";
	
	@XmlAttribute(required=true)
	private String value;

	@Override
	public Long getMinValueAsLong() {
		return Long.parseLong(value);
	}
	@Override
	public Double getMinValueAsDouble() {
		return Double.parseDouble(value);
	}
	@Override
	public Long getMaxValueAsLong() {
		return null;
	}
	@Override
	public Double getMaxValueAsDouble() {
		return null;
	}

	@Override
	public String getFunctionValidation() {
		return ValidatorFactory.VALIDATION_MIN_MAX_FUNCTION;
	}

}
